package twoD.IsoPfem.math;

/**
 * A function [a, b] -> R.
 * 
 * @author Matthias Baitsch
 */
public interface FunctionRToR {

	/**
	 * Evaluates the derivative at the specified point.
	 * 
	 * @param x
	 *            point
	 * @return the derivative
	 */
	public double derivativeAt(double x);

	/**
	 * Returns the interval representing the domain on which the function is
	 * defined.
	 * 
	 * @return the domain
	 */
	public Interval getDomain();

	/**
	 * Computes the function value at the specified point
	 * 
	 * @param x
	 *            point
	 * @return the function value
	 */
	public double valueAt(double x);

	/**
	 * Returns the polynomial degree of this function or -1 if the function is
	 * not a polynomial. If this function is piecewise defined, getP returns the
	 * maximum polynomial degree.
	 * 
	 * @return the equivalent polynomial degree or -1 if this function is not a
	 *         polynomial
	 */
	public int getP();

	/**
	 * Returns the breakpoints of a piecewise defined function. Example: For the
	 * function
	 * 
	 * <pre>
	 *        | x      if x &lt; 1
	 * f(x) = | 1      if 1 &lt;= x &lt; 2
	 *        | 1-0.5x if 2 &lt;= x
	 * </pre>
	 * 
	 * this method would return the breakpoints [1, 2].
	 * 
	 * @return the breakpoints or <code>null</code>, if the function is not
	 *         defined piecewise.
	 */
	public double[] getBreakpoints();
}
